package com.bd.scm.module.utils;

import com.bd.scm.module.enums.ExceptionEmun;
import com.bd.utils.vo.Result;

public class ResultUtil extends Result {

    public static Result<Object> error(ExceptionEmun exceptionEmun) {
        return error(exceptionEmun.getCode(), exceptionEmun.getMsg());
    }

    public static Result<Object> errorLogin() {
        return error(ExceptionEmun.LOGIN_TIMEOUTORNOTLOGIN.getCode(), ExceptionEmun.LOGIN_TIMEOUTORNOTLOGIN.getMsg());
    }

    public static Result<Object> error(Object data) {
        Result<Object> r = new Result();
        r.setSuccess(false);
        r.setCode(ExceptionEmun.SERVICE_ERROR_OPERATE.getCode());
        r.setMessage(ExceptionEmun.SERVICE_ERROR_OPERATE.getMsg());
        r.setResult(data);
        return r;
    }
}
